fix(event proto): reject malformed internal protobuf instead of panicking - #26292
fix(event proto): reject malformed internal protobuf instead of panicking#26292bruceg wants to merge 7 commits into
Conversation
…king Decode Vector's native event protobuf through `TryFrom` so a missing `oneof` or NaN float drops the record with error telemetry rather than crashing the source, tap, or disk-buffer reader.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b2ca337e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub enum EventProtoError { | ||
| #[snafu(display( | ||
| "event protobuf was structurally valid but an event or metric variant was absent or unrecognized; this often indicates a version mismatch" | ||
| ))] | ||
| UnrecognizedEventVariant, | ||
| #[snafu(display( | ||
| "event protobuf contained a NaN float, which cannot be represented in Vector's event model" | ||
| ))] | ||
| NanFloat, | ||
| #[snafu(display("event protobuf contained an invalid timestamp"))] | ||
| InvalidTimestamp, | ||
| } |
There was a problem hiding this comment.
An event can have NaN and also invalid timestamp. These errors can be modeled more cleanly with something like:
DecodeError::InvalidEvent {
source: EventProtoError,
}There was a problem hiding this comment.
Do these conversion errors need to be public at all? The nested Log, Metric, metadata, and sketch conversions could be private functions returning a private error, with the existing DecodeError type exposed at the boundary.
There was a problem hiding this comment.
Not really, except that the TryFrom for EventWrapper / EventArray cannot use a private Error type, so that results in a ton of churn (~300 lines). I can go ahead with it if you're agreeable to that.
pront
left a comment
There was a problem hiding this comment.
Mostly LGMT, let's one new comment on the enum thread.
| pub enum EventProtoError { | ||
| #[snafu(display( | ||
| "event protobuf was structurally valid but an event or metric variant was absent or unrecognized; this often indicates a version mismatch" | ||
| ))] | ||
| UnrecognizedEventVariant, | ||
| #[snafu(display( | ||
| "event protobuf contained a NaN float, which cannot be represented in Vector's event model" | ||
| ))] | ||
| NanFloat, | ||
| #[snafu(display("event protobuf contained an invalid timestamp"))] | ||
| InvalidTimestamp, | ||
| } |
There was a problem hiding this comment.
Do these conversion errors need to be public at all? The nested Log, Metric, metadata, and sketch conversions could be private functions returning a private error, with the existing DecodeError type exposed at the boundary.
Summary
Decode Vector's native event protobuf through
TryFromso a missingoneofor NaN float drops the record with error telemetry rather than crashing the source, tap, or disk-buffer reader.References
Vector configuration
N/A
How did you test this PR?
Unit tests included
Does this PR include user facing changes?
no-changeloglabel to this PR.Contributor Guidelines
@vectordotdev/vectorto reach out to us regarding this PR.git merge origin masterandgit push.